﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ActivitiesControl.GUI.Silverlight.RemoteServices;
using System.ServiceModel;

namespace ActivitiesControl.GUI.Silverlight.Services
{
	public sealed class ServiceLocator
	{
		
		private ActivitiesControlServicesClient service;

		public ActivitiesControlServicesClient Service
		{
			get
			{
				if (service == null)
				{
					string serviceEndPointName = "ProductionBasicHttpBinding_IActivitiesControlServices";

#if DEBUG
					serviceEndPointName = "DevelopmentBasicHttpBinding_IActivitiesControlServices";
#endif
					service = new ActivitiesControlServicesClient(serviceEndPointName);
				}

				return service;
			}
			set { service = value; }
		}

		private static volatile ServiceLocator instance;
		private static object syncRoot = new Object();
		public static ServiceLocator Instance
		{
			get
			{
				if (instance == null)
				{
					lock (syncRoot)
					{
						if (instance == null)
							instance = new ServiceLocator();
					}
				}
				return instance;
			}
		}
		private ServiceLocator() 
		{
			
		}
	}
}